jQuery(document).ready(function(){
	$j("#gathering").fadeIn("slow");
	
	$j("#updatemessage").text("Attempting to connect to server... Please wait...");
	
	$j.ajax({
	  type: "POST",
	  url: domain+"updates/retrive",
	  data: "action=start",
	  dataType: "json",
	  error: function(msg){
			$j("#gathering").addClass("gathering-error");
			$j("#progress #pmessage").text("Ops! There was error with loading... Please report problem!");
	  },
	  success: function(data){
			
			if ( data.status == "true" )
			{
				$j("#gathering").removeClass("gathering-error");
				$j("#updatemessage").text(data.message);
			}
			else{
				$j("#gathering").addClass("gathering-error");
				$j("#update_indicator").fadeOut("fast");
				$j("#updatemessage").text(data.message);
			}
	  }
	});
	
	
	function step2()
	{
		$j.ajax({
		  type: "POST",
		  url: domain+"updates/check",
		  data: "action=start",
		  dataType: "json",
		  error: function(msg){
				$j("#progress").addClass("gathering-error");
				$j("#progress #pmessage").text("Ops! There was error with loading... Please report problem!");
		  },
		  success: function(data){
				
				if ( data.status == "true" )
				{
					$j("#gathering").removeClass("gathering-error");
					$j("#updatemessage").text("Server successfully contacted! Attempting to retrive data...");
				}
				else{
					$j("#gathering").addClass("gathering-error");
					$j("#updatemessage").text("Ops! There was error with contacting server!");
				}
		  }
		});
	}
});